<?php


namespace App\Http\Repositories\ProductCenter;


use App\Http\Repositories\BaseRepository;
use App\Models\ProductCenter\Models\SystemTypeModel;

class SystemTypeRepository  extends BaseRepository
{
    public $type;
    public function __construct(SystemTypeModel $type)
    {
        $this->type = $type;
    }

    public function getSystemTypeInfo($data)
    {
        $where['id'] = $data['id'];
        return $this->type->getInfo($where);
    }

    public function getSystemTypeList($data)
    {
        $where = [];
        is_real_exists(@$data['label']) && $where['label'] = ['like', '%'.$data['label'].'%'];
        is_real_exists(@$data['value']) && $where['value'] = ['like', '%'.$data['value'].'%'];

        return $this->type->getListByPage($where);

    }

    public function addSystemType($data)
    {
        return $this->type->addItem($data, true);
    }

    public function editSystemType($data)
    {
        $where['id'] = $data['id'];

        $this->type->editItem($where, $data);

        return [];
    }

    public function delSystemType($data)
    {
        return $this->type->deleteItem($data);
    }

    public function getSystemTypeSelectList($data)
    {
        return $this->type->getList([], 'id,label,value');
    }


    public function uploadExcel($data)
    {

    }
}
